﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.QcManagement;
using Digitalmes.Model.ProductManagement;

namespace Digitalmes.Model.QcManagement
{
    /// <summary>
    /// 检验模板
    /// </summary>
	[Table("QcTemplate")]

    [Display(Name = "_Model.QcTemplate")]
    public class QcTemplate : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._QcTemplate._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._QcTemplate._Name")]
        [Comment("模板名称")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string Name { get; set; }
        [Display(Name = "_Model._QcTemplate._Code")]
        [Comment("模板编码")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string Code { get; set; }
        [Display(Name = "_Model._QcTemplate._ProductId")]
        [Comment("检验产品")]
        public long? ProductId { get; set; }

        public Product Product { get; set; }    

        [Display(Name = "_Model._QcTemplate._ProductionName")]
        [Comment("产品名称")]
        public string ProductionName { get; set; }
        [Display(Name = "_Model._QcTemplate._QcMode")]
        [Comment("质检模式")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public QcModeEnum? QcMode { get; set; }
        [Display(Name = "_Model._QcTemplate._Aux_1")]
        [Comment("备注1")]
        public string Aux_1 { get; set; }
        [Display(Name = "_Model._QcTemplate._Aux_2")]
        [Comment("备注2")]
        public string Aux_2 { get; set; }
        [Display(Name = "_Model._QcInspectItem._Template")]
        [InverseProperty("Template")]
        public List<QcInspectItem> QcInspectItem_Template { get; set; }
        [Display(Name = "_Model._QcSheet._Template")]
        [InverseProperty("Template")]
        public List<QcSheet> QcSheet_Template { get; set; }
        [Display(Name = "_Model._QcTemplate._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
